package org.senseframework.support.orm.mybatis.mysql;

import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.senseframework.support.orm.mybatis.query.builder.DeleteBuilder;
import org.senseframework.support.orm.mybatis.query.builder.InsertBuilder;
import org.senseframework.support.orm.mybatis.query.builder.QueryBuilder;
import org.senseframework.support.orm.mybatis.query.builder.UpdateBuilder;

import java.math.BigDecimal;
import java.util.List;

/**
 * Author lanjian
 * Email  jianlan@iflytek.com
 */
public interface MysqlBaseMapper<T> {

    @SelectProvider(type = MysqlBaseGen.class, method = "one")
    T one(QueryBuilder queryBuilder);

    @SelectProvider(type = MysqlBaseGen.class, method = "list")
    List<T> list(QueryBuilder queryBuilder);

    @SelectProvider(type = MysqlBaseGen.class, method = "count")
    int count(QueryBuilder queryBuilder);

    @SelectProvider(type = MysqlBaseGen.class, method = "sum")
    BigDecimal sum(QueryBuilder queryBuilder);

    @UpdateProvider(type = MysqlBaseGen.class, method = "update")
    int update(UpdateBuilder updateBuilder);

    @InsertProvider(type = MysqlBaseGen.class, method = "insert")
    int insert(InsertBuilder insertBuilder);

    @DeleteProvider(type = MysqlBaseGen.class, method = "delete")
    void delete(DeleteBuilder deleteBuilder);

}
